<?php
/*----------------------------------------------------------------------
 * 后台日志管理
 * Author: ming.nie
----------------------------------------------------------------------*/

namespace Admin\Controller;
use Think\Controller;

class LogController extends AdminController{

    //日志列表
    public function logList()
    {
        $logLogic = new \Common\Logic\LogLogic();
        $option = $_GET['option'];
        if(array_key_exists('option', $_GET) && $_GET['option']) {
            $option = str_replace('_', '/', $_GET['option']);
        }
        
        //查询当前影院用户的充值记录
        $params = array();
        $params['page_size'] = 20;
        $params['keywords'] = $keywords = I('request.keywords', '', 'strip_tags');
        $params['option'] = $option;
        $params['create_time_start'] = $create_time_start = I('get.create_time_start');
        $params['create_time_end'] = $create_time_end = I('get.create_time_end');
        $data_list_data = $logLogic->getLogList($params);
        
        //统计选项
        $log_options_data = getLogOptions();
        $log_options_data = array(''=>'全部')+$log_options_data;
        $log_options = array();
        foreach($log_options_data as $key => $value) {
            $temp_key = str_replace('/', '_', $key);
            $log_options[$temp_key] = $value;
        }
        $option = str_replace('/', '_', $option);
        
        $page_title = '日志列表';
        $this->assign(get_defined_vars());
        $this->display('logList');
    }
    
    //日志详情
    public function detail()
    {
        $logLogic = new \Common\Logic\LogLogic();
        
        $log_id = I('request.log_id');
        
        $model = $logLogic->find($log_id);
        
        //统计选项
        $log_options = getLogOptions();
        
        $page_title = '日志详情';
        $this->assign(get_defined_vars());
        $this->display('detail');
    }
}
